import os
import sqlite3

class DATA(object):
    def __init__(self,data = 'data.db') -> None:
        if not os.path.exists(data):
            conn = sqlite3.connect(data)
            cursor = conn.cursor()
            # conn.execute("drop table if exists works;")
            cursor.executescript('''
                            create table if not exists setting (id INTEGER PRIMARY KEY autoincrement,status BOOLEAN);
                            create table if not exists T10 (id INTEGER PRIMARY KEY autoincrement,time DATETIME,WBT REAL,Temp REAL, Humi INTEGER, DBT REAL);
                            create table if not exists A8 (id INTEGER PRIMARY KEY autoincrement,time DATETIME,A1 INTEGER,A2 INTEGER,A3 INTEGER,A4 INTEGER,A5 INTEGER,A6 INTEGER,A7 INTEGER,A8 INTEGER);
                            ''')
            conn.commit()
            conn.close()

